home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / epmgcc30.zip / IPFPARSE.E < prev    next >
Text File  |  1996-07-06  |  3KB  |  71 lines

  1. /*
  2. ╔══════════════════════════════════════════════════════════════════════════════╗
  3. ║ What's it called: EPMGCC  V3.00                                              ║
  4. ║                                                                              ║
  5. ║ What does it do:  The E source code for the GCC-Interface for EPM.           ║
  6. ║                   This file contains the code for the error parser of        ║
  7. ║                   compile time errors issued by IPF.                         ║
  8. ║                   This module is linked seperately to allow the user to      ║
  9. ║                   change the error-parser during runtime. See the            ║
  10. ║                   documentation for details.                                 ║
  11. ║                                                                              ║
  12. ║ Who and When:     B. Bablok 12/93 - 07/96                                    ║
  13. ║                                                                              ║
  14. ╚══════════════════════════════════════════════════════════════════════════════╝
  15. */
  16. DEFC gcc_parse_error =
  17.    UNIVERSAL gcc_error_file_id, gcc_other_file_id, gcc_error_file,
  18.              gcc_line2index, gcc_index2err, gcc_error_index
  19.  
  20.    parse_all = ARG(1) <> ''
  21.    error_no = 0
  22.    col      = 1                        -- ipf gives no info on column of error
  23.  
  24.    WHILE (.line <= .last) DO           -- iterate until a "true" error is found
  25.      GETLINE  line
  26.  
  27.       IF POS("<",WORD(line,1)) = 0 THEN
  28.          lineno = 'junk'
  29.       ELSE
  30.          PARSE VALUE line WITH "<" drive ":" filename ":" lineno ">" gcc_message
  31.          filename = drive":"filename
  32.       ENDIF
  33.  
  34.      IF NOT ISNUM(lineno) THEN
  35.        IF .line = .last THEN
  36.           IF NOT parse_all THEN
  37.              ACTIVATEFILE gcc_other_file_id
  38.              SAYERROR "No more errors!"
  39.           ELSE
  40.              DO_ARRAY 2, gcc_line2index, 0, error_no
  41.              DO_ARRAY 2, gcc_index2err, 0, error_no
  42.           ENDIF
  43.           RETURN
  44.        ELSE                           -- try the next line
  45.          "+1"
  46.        ENDIF
  47.  
  48.      ELSEIF NOT parse_all THEN                              -- found an error
  49.        "EDIT" TRANSLATE(filename,'\','/') "'"lineno"'"
  50.        SAYERROR gcc_message
  51.        RETURN
  52.  
  53.      ELSE
  54.        error_no = error_no + 1
  55.        DO_ARRAY 2, gcc_line2index, .line, error_no
  56.        DO_ARRAY 2, gcc_index2err, 'line.'error_no, lineno
  57.        DO_ARRAY 2, gcc_index2err, 'col.'error_no, col
  58.        DO_ARRAY 2, gcc_index2err, 'file.'error_no, filename
  59.        DO_ARRAY 2, gcc_index2err, 'msg.'error_no, gcc_message
  60.        line = .line
  61.        DO_ARRAY 2, gcc_index2err, 'orig.'error_no, line
  62.        IF .line = .last THEN
  63.           DO_ARRAY 2, gcc_line2index, 0, error_no
  64.           DO_ARRAY 2, gcc_index2err, 0, error_no
  65.           RETURN
  66.        ELSE
  67.          "+1"
  68.        ENDIF
  69.      ENDIF
  70.    ENDWHILE
  71.